home *** CD-ROM | disk | FTP | other *** search
- (*--------------------------------------------------------------------------*)
- (* Emulate_Gossip --- Gossip Mode from PibTerm to PibTerm *)
- (*--------------------------------------------------------------------------*)
-
- OVERLAY PROCEDURE Emulate_Gossip;
-
- (*--------------------------------------------------------------------------*)
- (* *)
- (* Procedure: Emulate_Gossip *)
- (* *)
- (* Purpose: Provides split-screen gossip mode, dumb terminal *)
- (* emulation. *)
- (* *)
- (* Calling sequence: *)
- (* *)
- (* Emulate_Gossip; *)
- (* *)
- (* Calls: *)
- (* *)
- (* Async_Receive *)
- (* Process_Command *)
- (* KeyPressed *)
- (* Async_Send *)
- (* Display_Character *)
- (* *)
- (* Called by: *)
- (* *)
- (* PibTerm (Main) *)
- (* *)
- (*--------------------------------------------------------------------------*)
-
- VAR
- MyX: INTEGER;
- MyY: INTEGER;
- YourX: INTEGER;
- YourY: INTEGER;
- Save_Local: BOOLEAN;
- I: INTEGER;
- Comm_Ch: CHAR;
- Done: BOOLEAN;
-
- BEGIN (* Emulate_Gossip *)
- (* Turn on local echo, set initial *)
- (* positions for each user's *)
- (* message area. *)
- Save_Local := Local_Echo;
- Local_Echo := TRUE;
- MyX := 1;
- MyY := 1;
- YourX := 1;
- YourY := 1;
- Done := FALSE;
- (* Split screen into two parts: *)
- (* Upper for local user, lower for *)
- (* remote user. *)
- Window( 1, 1, 80, 25 );
- ClrScr;
-
- (* Print divider *)
- GoToXY( 1 , 13 );
-
- FOR I := 1 TO 25 DO WRITE('=');
- WRITE('Enter ALT-G to exit chat mode');
- FOR I := 1 TO 26 DO WRITE('=');
-
- REPEAT
- (* Check comm buff overflow *)
- Async_Buffer_Full;
- (* Process local user's input *)
- IF KeyPressed THEN
- BEGIN
-
- Window( 1, 14, 80, 25 );
- GoToXY( MyX, MyY );
-
- READ( Kbd , Comm_Ch );
-
- CASE ORD( Comm_Ch ) OF
-
- ESC: IF KeyPressed THEN
- BEGIN
- Process_Command( Comm_Ch, FALSE, PibTerm_Command );
- IF PibTerm_Command <> Null_Command THEN
- Execute_Command( PibTerm_Command, Done, FALSE );
- END
- ELSE
- BEGIN
- IF Local_Echo THEN WRITE( Comm_Ch );
- Async_Send( Comm_Ch );
- END;
-
-
- BS: BEGIN
- Comm_Ch := BS_Char;
- IF Local_Echo THEN
- Display_Character( Comm_Ch );
- Async_Send( Comm_Ch );
- END;
-
- DEL: BEGIN
- Comm_Ch := Ctrl_BS_Char;
- IF Local_Echo THEN
- Display_Character( Comm_Ch );
- Async_Send( Comm_Ch );
- END;
-
- CR: BEGIN
- IF Local_Echo THEN WRITELN( Comm_Ch );
- Async_Send( Comm_Ch );
- END;
-
- ELSE
- BEGIN
- IF Local_Echo THEN
- Display_Character( Comm_Ch );
- Async_Send( Comm_Ch );
- END;
-
- END (* CASE ORD( Comm_Ch ) *);
-
- (* Remember position! *)
- MyX := WhereX;
- MyY := WhereY;
-
- END (* KeyPressed *);
- (* Process script file entry *)
-
- IF ( Script_File_Mode AND ( NOT ( Done OR Really_Wait_String ) ) ) THEN
- BEGIN
- Get_Script_Command( PibTerm_Command );
- Execute_Command ( PibTerm_Command , Done , TRUE );
- END;
- (* Process remote user's input *)
-
- IF Async_Receive( Comm_Ch ) THEN
-
- BEGIN (* Comm_Ch found *)
- (* Check comm buff overflow *)
- Async_Buffer_Full;
-
- Window( 1, 1, 80, 12 );
- GoToXY( YourX, YourY );
-
- Display_Character( TrTab[ Comm_Ch ] );
-
- YourX := WhereX;
- YourY := WhereY;
-
- END (* Comm_Ch found *);
-
- UNTIL ( NOT Gossip_Mode_On ) OR Done;
-
- (* Restore single screen mode *)
- Local_Echo := Save_Local;
-
- Window( 1, 1, 80, 25 );
- ClrScr;
-
- END (* Emulate_Gossip *);